IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > DataEntityProperty<TInstance,TValue> Class : SetterInterceptor Property |
'Declaration
Public ReadOnly Property SetterInterceptor As PropertyInterceptor(Of TInstance,TValue,DataEntityPropertySetInterceptorArgs(Of TInstance,TValue))
'Usage
Dim instance As DataEntityProperty(Of TInstance,TValue) Dim value As PropertyInterceptor(Of TInstance,TValue,DataEntityPropertySetInterceptorArgs(Of TInstance,TValue)) value = instance.SetterInterceptor
public PropertyInterceptor<TInstance,TValue,DataEntityPropertySetInterceptorArgs<TInstance,TValue>> SetterInterceptor {get;}
Any registered OnBeforeSetTriggers and OnAfterSetTriggers verifiers will be executed based on the IdeaBlade.Validation.VerifierOptions.ExecutionModes in effect for the interceptor. This verification is done immediately before and after the value is stored in the backing field. BeforeSet actions will occur before OnBeforeSet verification and AfterSet actions will occur after OnAfterSet verification.
Will be null for a readonly property.
public void Sample() { // Add a BeforeGet action to a GetterInterceptor: Employee.PropertyMetadata.Address.GetterInterceptor.AddAction( PropertyInterceptorTiming.Before, TraceGetter); // Add a BeforeSet action to a SetterInterceptor: Employee.PropertyMetadata.Country.SetterInterceptor.AddAction( PropertyInterceptorTiming.Before, TraceSetter); // Get/set a few properties DomainModelEntityManager mgr = new DomainModelEntityManager(); Employee e = mgr.Employees.First(); string addy = e.Address; e.Country = "UK"; } public static void TraceGetter(IEntityPropertyGetInterceptorArgs args) { Console.WriteLine("getter called for " + args.EntityProperty.Name); } public static void TraceSetter(IEntityPropertySetInterceptorArgs args) { Console.WriteLine("setter called for " + args.EntityProperty.Name); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2